package transporter

import (
	"io"
	"os"
	"os/exec"
)

type LocalExecutor struct {
}

func NewLocalExecutor() *LocalExecutor {
	return &LocalExecutor{}
}

func (e LocalExecutor) Exec(cmdStmt []string, stdio, stderr io.Writer) error {
	cmd := exec.Command(cmdStmt[0], cmdStmt[1:]...)
	cmd.Stdout = stdio
	cmd.Stderr = stderr
	return cmd.Run()
}

func (e LocalExecutor) ReadFile(name string) ([]byte, error) {
	return os.ReadFile(name)
}
